//
//  UIButton+DXExtension.m
//  OC-DXWeibo
//
//  Created by xiongdexi on 16/4/7.
//  Copyright © 2016年 DXSmile. All rights reserved.
//

#import "UIButton+DXExtension.h"

@implementation UIButton (DXExtension)

- (instancetype)initWithImageName:(NSString *)imageName backImageName:(NSString *)backImageName {

    UIButton *button = [[UIButton alloc] init];
    
    [button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@_highlighted",imageName]] forState:UIControlStateHighlighted];
    [button setBackgroundImage:[UIImage imageNamed:backImageName] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@_highlighted", backImageName]] forState:UIControlStateHighlighted];
    [button sizeToFit];
    
    return button;
}


@end
